<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Adds a curve</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="cairocontext.copypathflat.html">CairoContext::copyPathFlat</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="cairocontext.devicetouser.html">CairoContext::deviceToUser</a></div>
 <div class="up"><a href="class.cairocontext.html">CairoContext</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="cairocontext.curveto" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">CairoContext::curveTo</h1>
  <h1 class="refname">cairo_curve_to</h1>
  <p class="verinfo">(PECL cairo &gt;= 0.1.0)</p><p class="refpurpose"><span class="refname">CairoContext::curveTo</span> -- <span class="refname">cairo_curve_to</span> &mdash; <span class="dc-title">Adds a curve</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-cairocontext.curveto-description">
  <h3 class="title">说明</h3>
  <p class="para">面向对象风格 (method):</p>
   <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>CairoContext::curveTo</strong></span>
    ( <span class="methodparam"><span class="type">float</span> <code class="parameter">$x1</code></span>
   , <span class="methodparam"><span class="type">float</span> <code class="parameter">$y1</code></span>
   , <span class="methodparam"><span class="type">float</span> <code class="parameter">$x2</code></span>
   , <span class="methodparam"><span class="type">float</span> <code class="parameter">$y2</code></span>
   , <span class="methodparam"><span class="type">float</span> <code class="parameter">$x3</code></span>
   , <span class="methodparam"><span class="type">float</span> <code class="parameter">$y3</code></span>
    )</div>

  <p class="para rdfs-comment">过程化风格:</p>
  <div class="methodsynopsis dc-description">
   <span class="type"><span class="type void">void</span></span> <span class="methodname"><strong>cairo_curve_to</strong></span>
    ( <span class="methodparam"><span class="type"><a href="class.cairocontext.html" class="type CairoContext">CairoContext</a></span> <code class="parameter">$context</code></span>
   , <span class="methodparam"><span class="type">float</span> <code class="parameter">$x1</code></span>
   , <span class="methodparam"><span class="type">float</span> <code class="parameter">$y1</code></span>
   , <span class="methodparam"><span class="type">float</span> <code class="parameter">$x2</code></span>
   , <span class="methodparam"><span class="type">float</span> <code class="parameter">$y2</code></span>
   , <span class="methodparam"><span class="type">float</span> <code class="parameter">$x3</code></span>
   , <span class="methodparam"><span class="type">float</span> <code class="parameter">$y3</code></span>
   )</div>

  <p class="para rdfs-comment">
   Adds a cubic Bezier spline to the path from the current point to position <em><code class="parameter">x3</code></em>
   ,<em><code class="parameter">y3</code></em> in user-space coordinates, using <em><code class="parameter">x1</code></em>,
   <em><code class="parameter">y1</code></em> and <em><code class="parameter">x2</code></em>, <em><code class="parameter">y2</code></em> as the control
   points. After this call the current point will be <em><code class="parameter">x3</code></em>, <em><code class="parameter">y3</code></em>.
  </p>
  <p class="para">
    If there is no current point before the call to <span class="methodname"><strong>CairoContext::curveTo()</strong></span>
    this function will behave as if preceded by a call to <span class="methodname"><a href="cairocontext.moveto.html" class="methodname">CairoContext::moveTo()</a></span>
    (<em><code class="parameter">x1</code></em>, <em><code class="parameter">y1</code></em>).
  </p>
 
 </div>


 <div class="refsect1 parameters" id="refsect1-cairocontext.curveto-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">context</code></em></dt>

     <dd>

      <p class="para">
       A valid <a href="class.cairocontext.html" class="classname">CairoContext</a> object created with
       <span class="methodname"><a href="cairocontext.construct.html" class="methodname">CairoContext::__construct()</a></span> or <span class="function"><a href="function.cairo-create.html" class="function">cairo_create()</a></span>
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">x1</code></em></dt>

     <dd>

      <p class="para">
       First control point in the x axis for the curve
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">y1</code></em></dt>

     <dd>

      <p class="para">
       First control point in the y axis for the curve
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">x2</code></em></dt>

     <dd>

      <p class="para">
       Second control point in x axis for the curve
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">y2</code></em></dt>

     <dd>

      <p class="para">
       Second control point in y axis for the curve
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">x3</code></em></dt>

     <dd>

      <p class="para">
       Final point in the x axis for the curve
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">y3</code></em></dt>

     <dd>

      <p class="para">
       Final point in the y axis for the curve
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-cairocontext.curveto-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   没有返回值。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-cairocontext.curveto-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-2804">
    <p><strong>Example #1 面向对象风格</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$s&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">CairoImageSurface</span><span style="color: #007700">(</span><span style="color: #0000BB">CairoFormat</span><span style="color: #007700">::</span><span style="color: #0000BB">ARGB32</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">100</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">100</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$c&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">CairoContext</span><span style="color: #007700">(</span><span style="color: #0000BB">$s</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$c</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setSourceRgb</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$c</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">paint</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">$c</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">moveTo</span><span style="color: #007700">(</span><span style="color: #0000BB">10</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">50</span><span style="color: #007700">);&nbsp;<br /></span><span style="color: #0000BB">$c</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setLineWidth</span><span style="color: #007700">(</span><span style="color: #0000BB">5</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$c</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setSourceRgb</span><span style="color: #007700">(</span><span style="color: #0000BB">.1</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$c</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">curveTo</span><span style="color: #007700">(</span><span style="color: #0000BB">20</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">80</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">80</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">20</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">90</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">50</span><span style="color: #007700">);&nbsp;<br /></span><span style="color: #0000BB">$c</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">stroke</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">$s</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">writeToPng</span><span style="color: #007700">(</span><span style="color: #0000BB">dirname</span><span style="color: #007700">(</span><span style="color: #0000BB">__FILE__</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">'/curveTo.png'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
     </div>

   </div>
  </p>
  <p class="para">
   <div class="example" id="example-2805">
    <p><strong>Example #2 过程化风格</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$s&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cairo_image_surface_create</span><span style="color: #007700">(</span><span style="color: #0000BB">CAIRO_SURFACE_TYPE_IMAGE</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">100</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">100</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$c&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cairo_create</span><span style="color: #007700">(</span><span style="color: #0000BB">$s</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">cairo_set_source_rgb</span><span style="color: #007700">(</span><span style="color: #0000BB">$c</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">cairo_paint</span><span style="color: #007700">(</span><span style="color: #0000BB">$c</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">cairo_move_to</span><span style="color: #007700">(</span><span style="color: #0000BB">$c</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">10</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">50</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">cairo_set_line_width</span><span style="color: #007700">(</span><span style="color: #0000BB">$c</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">5</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">cairo_set_source_rgb</span><span style="color: #007700">(</span><span style="color: #0000BB">$c</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">.1</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">cairo_curve_to</span><span style="color: #007700">(</span><span style="color: #0000BB">$c</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">20</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">80</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">80</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">20</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">90</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">50</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">cairo_stroke</span><span style="color: #007700">(</span><span style="color: #0000BB">$c</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">cairo_surface_write_to_png</span><span style="color: #007700">(</span><span style="color: #0000BB">$s</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">dirname</span><span style="color: #007700">(</span><span style="color: #0000BB">__FILE__</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">'/curve_to.png'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
     </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-cairocontext.curveto-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="methodname"><a href="cairocontext.moveto.html" class="methodname" rel="rdfs-seeAlso">CairoContext::moveTo()</a> - The moveTo purpose</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="cairocontext.copypathflat.html">CairoContext::copyPathFlat</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="cairocontext.devicetouser.html">CairoContext::deviceToUser</a></div>
 <div class="up"><a href="class.cairocontext.html">CairoContext</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
